package cn.itsource.easypoi;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ExcelTarget("employee")  //给当前类取一个名字
public class EasyEmployee {
    private Long id;
    @Excel(name = "姓名",width = 20)
    private String name;
    @Excel(name="年龄",width = 20)
    private Integer age;
    @Excel(name = "性别",width = 20, replace = { "男_true", "女_false" })
    private Boolean sex;
    @Excel(name="生日",width = 20,format = "yyyy-MM-dd")
    private Date birthDay;

//    type=2:代表是导出是一个图片，而不是一个字符串，但是只针对于png和jpg有效
    @Excel(name = "头像",type =2,savePath = "imgs/upload")
    private String imgPath;

    @ExcelEntity //穿透关联对象，把关联对象的excel一并导出
    private EasyDept dept;
}
